package com.no1.controller.admin;

import com.no1.dao.FunctionDao;
import com.no1.entity.Function;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "QueryFunController",urlPatterns = "/user/queryFun")
public class QueryFunController extends HttpServlet {
    private FunctionDao fd = new FunctionDao();
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取所有功能
        List<Function> value = fd.getAllFun();
        request.setAttribute("functions",value);
        request.getRequestDispatcher("/WEB-INF/jsp/queryFun.jsp").forward(request,response);
    }
}
